package com.freewater.springboot.demo.ioc.collectionmerge;

import com.freewater.springboot.demo.PackageUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.context.support.GenericApplicationContext;

import java.util.List;

@Slf4j
public class Main {

    public static void main(String[] args) {
        GenericApplicationContext applicationContext = new GenericApplicationContext();
        new XmlBeanDefinitionReader(applicationContext).loadBeanDefinitions("classpath:" + PackageUtils.getClassPathFroClass(Main.class) + "/applicationContext.xml");
        applicationContext.refresh();
        final BeanA beanA = applicationContext.getBean("beanA", BeanA.class);
        final List<String> emails = beanA.getEmails();
        log.info("{}", emails.size());
        for (String email : emails) {
            log.info(email);
        }
    }
}
